package com.panfeng.xcloud.boss.provider.assets.web.rpc;

import com.panfeng.xcloud.boss.provider.dto.request.SyncBasicInfoReqDTO;
import com.panfeng.xcloud.boss.provider.rpc.assets.AssetsBasicInfoFeignApi;
import com.panfeng.xcloud.common.core.configuration.DataDictionaryConfig;
import com.panfeng.xcloud.common.core.utils.BeanUtils;
import com.panfeng.xcloud.common.core.web.vo.ResponseVO;
import com.panfeng.xcloud.common.security.annotation.NotNeedAccess;
import com.panfeng.xcloud.common.security.annotation.NotNeedFeignAccess;
import com.panfeng.xcloud.common.security.web.support.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@Api(value = "API - AssetsBasicInfoApiFeignClient", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class AssetsBasicInfoApiFeignClient extends BaseController implements AssetsBasicInfoFeignApi {

	@Autowired
	private DataDictionaryConfig dataDictionaryConfiguration;

	@NotNeedAccess
	@NotNeedFeignAccess
	@PostMapping(value = "/feignApi/assets/syncInfo", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiOperation(httpMethod = "POST", value = "rest-rpc初始化-syncBasicInfo操作")
	@Override
	public ResponseVO syncBasicInfo(@RequestBody SyncBasicInfoReqDTO syncBasicInfoReqDTO) {
		dataDictionaryConfiguration.setCodeToNameMap(syncBasicInfoReqDTO.getCodeToNameMap());
		return ResponseVO.success();
	}

}
